#ifndef __QUEUE_HPP__
#define __QUEUE_HPP__

#include <deque>
#include "command.hpp"

struct Queue {
	struct Exception {
		static const int NULL_COMMAND = 0;
		Exception(int err, const char *m):
			error(err), msg((char*) m) {}

		char *msg;
		int error;
	};

	const char *getPriorityString(Command *comm);
	void setPriority(Command *comm, int priority);
	int getPriority(Command *comm);

	void pushCommand(Command *comm);
	void schedule();
	void execQueue();

	struct _prioritySort {
		bool operator() (Command *c1, Command *c2) {
			return (c1->_priority < c2->_priority);
		}
	} prioritySort;

private:
	std::deque<Command*> _commands;
};

#endif
